/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hjt1;

/**
 *
 * @author julio
 */
public class Radio implements iRadio {
    //Atributos
    
    boolean encendido;
    boolean radioFM;
    float   freq_am;
    float   freq_fm;
    float [] estaciones = estaciones = new float[12]; 
    
    public Radio(){
        
        encendido = false;       //La radio inicia apagada 
        radioFM = true;          //La radio empezara con la configuracion FM
        freq_am = 530;           //Modulo Am comienza en su rango menor
        freq_fm = (float) 87.9; 
        
        
        
    }
    

    @Override
    public boolean power() {
        
        if(encendido == true){
            
            encendido = false; 
           
        }else{
            encendido = true;
        }
        
        return encendido; 
        
    }

    @Override
    public boolean ChangeSignal() {
        
        if(radioFM == true){
            
            radioFM = false;
           
        }
        else {
            
            radioFM = true;
            
        }
        
        return radioFM;
    }

    @Override
    public float NextFreq() {
        
        if(radioFM == true){
            if(freq_fm <= 107.9){
            
                freq_fm = (float) (freq_fm + 0.2);
            }
            else{
                
                freq_fm = (float) 87.9;
                
            }
            return freq_fm;
        }  
        else{
            
            if(freq_am <= 1610){
                
                freq_am = freq_am + 10;
                
            }
            else{
                
                freq_am = 530;
                
            }
            
            return freq_am;
            
        }         
                    
         
    }

    @Override
    public boolean SaveFreq(int Boton) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public float changeTune(int Boton) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean IsOn() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean IsAm() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public float get_Freq() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
